package com.atguigu.day09;

import org.apache.flink.streaming.api.CheckpointingMode;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

public class Flink01_Checkpoint_Barrier {
    public static void main(String[] args) {
        //1.获取流的执行环境
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        //TODO 开启CheckPoint 如果不额外指定默认是barrier对齐
        env.enableCheckpointing(5000);

        //barrier不对齐（至少以一次）
//        env.getCheckpointConfig().enableUnalignedCheckpoints();

        //barrier不对齐（精准一次）
        env.getCheckpointConfig().setCheckpointingMode(CheckpointingMode.EXACTLY_ONCE);
        env.getCheckpointConfig().enableUnalignedCheckpoints();

    }
}
